import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [{
      path: 'home',
      name: 'home',
      component: () => import('@/views/home/index'),
      meta: { title: '首页', icon: 'el-icon-s-home' }
    }]
  },
  {
    path: '/user_setting',
    component: Layout,
    redirect: "/user_setting/user_setting",
    children: [{
      path: 'user_setting',
      name: 'user_setting',
      component: () => import('@/views/user_setting/index'),
      meta: { title: '首页', icon: 'el-icon-s-home' },
      hidden: true
    }]
  },
  {
    path: '/academic',
    component: Layout,
    redirect: "/academic/goods",
    name: 'academic_title',
    meta: { title: '商品', icon: 'el-icon-shopping-bag-1' },
    children: [{
      path: 'goods',
      name: 'goods',
      component: () => import('@/views/goods/goods/index'),
      meta: { title: '商品列表', icon: 'el-icon-notebook-1' }
    },{
      path: 'goods_add',
      name: 'goods_add',
      component: () => import('@/views/goods/goods_add/index.vue'),
      meta: { title: '添加商品', icon: 'el-icon-folder-add' },
    },{
      path: 'goods_edit',
      name: 'goods_edit',
      component: () => import('@/views/goods/goods_edit/index'),
      meta: { title: '编辑商品', icon: '' },
      hidden: true
    },{
      path: 'goods_category',
      name: 'goods_category',
      component: () => import('@/views/goods/goods_category/index'),
      meta: { title: '商品类型', icon: 'el-icon-s-operation' }
    },{
      path: 'goods_category_add',
      name: 'goods_category_add',
      component: () => import('@/views/goods/goods_category_add/index'),
      meta: { title: '商品类型添加', icon: 'el-icon-folder-add' },
      // hidden: true
    },{
      path: 'goods_category_edit',
      name: 'goods_category_edit',
      component: () => import('@/views/goods/goods_category_edit/index'),
      meta: { title: '商品类型编辑', icon: '' },
      hidden: true
    },{
      path: 'brand',
      name: 'brand',
      component: () => import('@/views/goods/brand/index'),
      meta: { title: '品牌列表', icon: 'el-icon-price-tag' }
    },{
      path: 'brand_add',
      name: 'brand_add',
      component: () => import('@/views/goods/brand_add/index'),
      meta: { title: '添加品牌', icon: '' },
      hidden: true
    },{
      path: 'brand_edit',
      name: 'brand_edit',
      component: () => import('@/views/goods/brand_edit/index.vue'),
      meta: { title: '编辑品牌', icon: '' },
      hidden: true
    },]
  },
  {
    path: '/biz_base',
    component: Layout,
    redirect: "/biz_base/biz_base",
    name: 'biz_base',
    meta: { title: '商圈管理', icon: 'el-icon-notebook-2' },
    children: [{
      path: 'biz_base',
      name: 'biz_base',
      component: () => import('@/views/biz_base/index'),
      meta: { title: '商圈列表', icon: 'el-icon-notebook-2' },
    },{
      path: 'biz_base_add',
      name: 'biz_base_add',
      component: () => import('@/views/biz_base/biz_base_add/index'),
      meta: { title: '添加商圈', icon: 'el-icon-notebook-2' },
      // hidden: true
    },{
      path: 'biz_base_edit',
      name: 'biz_base_edit',
      component: () => import('@/views/biz_base/biz_base_edit/index'),
      meta: { title: '商圈编辑', icon: '' },
      hidden: true
    },{
      path: 'biz_base_detail',
      name: 'biz_base_detail',
      component: () => import('@/views/biz_base/biz_base_detail/index'),
      meta: { title: '商圈详情', icon: '' },
      hidden: true
    },]
  },

  {
    path: '/shop',
    component: Layout,
    redirect: "/shop/shop_list",
    name: 'shop',
    meta: { title: '店铺管理', icon: 'el-icon-notebook-2' },
    children: [{
      path: 'shop_list',
      name: 'shop_list',
      component: () => import('@/views/shop/shop_list/index'),
      meta: { title: '店铺列表', icon: 'el-icon-notebook-2' },
    },{
      path: 'shop_point',
      name: 'shop_point',
      component: () => import('@/views/shop/shop_point/index'),
      meta: { title: '积分明细', icon: '' },
      hidden: true
    },{
      path: 'shop_list_detail',
      name: 'shop_list_detail',
      component: () => import('@/views/shop/shop_list_detail/index'),
      meta: { title: '积分详情', icon: '' },
      hidden: true
    },{
      path: 'shop_list_add',
      name: 'shop_list_add',
      component: () => import('@/views/shop/shop_list_add/index'),
      meta: { title: '店铺列表添加', icon: 'el-icon-notebook-2' },
      // hidden: true
    },{
      path: 'shop_list_edit',
      name: 'shop_list_edit',
      component: () => import('@/views/shop/shop_list_edit/index'),
      meta: { title: '店铺列表编辑', icon: '' },
      hidden: true
    },{
      path: 'shop_category',
      name: 'shop_category',
      component: () => import('@/views/shop/shop_category/index'),
      meta: { title: '店铺类型列表', icon: 'el-icon-notebook-2' },
    },{
      path: 'shop_category_add',
      name: 'shop_category_add',
      component: () => import('@/views/shop/shop_category_add/index'),
      meta: { title: '店铺类型添加', icon: 'el-icon-notebook-2' },
      hidden: true
    },{
      path: 'shop_category_edit',
      name: 'shop_category_edit',
      component: () => import('@/views/shop/shop_category_edit/index.vue'),
      meta: { title: '店铺类型编辑', icon: '' },
      hidden: true
    },{
      path: 'shop_account_log',
      name: 'shop_account_log',
      component: () => import('@/views/shop/shop_account_log/index'),
      meta: { title: '收入信息', icon: '' },
      hidden: true
    },{
      path: 'biz_user',
      name: 'biz_user',
      component: () => import('@/views/shop/biz_user/index'),
      meta: { title: '收入信息', icon: '' },
      hidden: true
    },{
      path: 'shop_finance',
      name: 'shop_finance',
      component: () => import('@/views/shop/shop_finance/index'),
      meta: { title: '财务信息', icon: '' },
      hidden: true
    },{
      path: 'delivery',
      name: 'delivery',
      component: () => import('@/views/delivery/delivery/index'),
      meta: { title: '自提点列表', icon: 'el-icon-user-solid' }
    },{
      path: 'delivery_add',
      name: 'delivery_add',
      component: () => import('@/views/delivery/delivery_add/index'),
      meta: { title: '添加自提点', icon: 'el-icon-user-solid' },
    },{
      path: 'delivery_edit',
      name: 'delivery_edit',
      component: () => import('@/views/delivery/delivery_edit/index'),
      meta: { title: '编辑自提点', icon: 'el-icon-user-solid' },
      hidden: true
    },]
  },

  {
    path: '/finance',
    component: Layout,
    redirect: "/finance/withdraw",
    name: 'finance',
    meta: { title: '财务管理', icon: 'el-icon-user-solid' },
    children: [{
      path: 'withdraw',
      name: 'withdraw',
      component: () => import('@/views/finance/withdraw/index'),
      meta: { title: '提现列表', icon: 'el-icon-user-solid' }
    },{
      path: 'online_recharge',
      name: 'online_recharge',
      component: () => import('@/views/user/online_recharge/index'),
      meta: { title: '用户充值列表', icon: 'el-icon-user-solid' },
    },{
      path: 'other',
      name: 'other',
      component: () => import('@/views/blank/index'),
      meta: { title: '其它', icon: 'el-icon-user-solid' }
    },]
  },
  {
    path: '/experts',
    component: Layout,
    redirect: "/experts/experts",
    name: 'experts_title',
    meta: { title: '分销员管理', icon: 'el-icon-user-solid' },
    children: [{
      path: 'experts',
      name: 'experts',
      component: () => import('@/views/experts/experts/index'),
      meta: { title: '分销员列表', icon: 'el-icon-user-solid' }
    },{
      path: 'experts_add',
      name: 'experts_add',
      component: () => import('@/views/experts/experts_add/index'),
      meta: { title: '添加分销员', icon: 'el-icon-user-solid' },
      hidden: true
    },{
      path: 'experts_edit',
      name: 'experts_edit',
      component: () => import('@/views/experts/experts_edit/index'),
      meta: { title: '编辑分销员', icon: 'el-icon-user-solid' },
      hidden: true
    },{
      path: 'experts_detail',
      name: 'experts_detail',
      component: () => import('@/views/experts/experts_detail/index'),
      meta: { title: '分销员详情', icon: 'el-icon-user-solid' },
      hidden: true
    },{
      path: 'experts_category',
      name: 'experts_category',
      component: () => import('@/views/experts/experts_category/index'),
      meta: { title: '分销员类别', icon: 'el-icon-user-solid' }
    },{
      path: 'shop_relate',
      name: 'shop_relate',
      component: () => import('@/views/experts/shop_relate'),
      meta: { title: '分销员门店列表', icon: 'el-icon-user-solid' },
      hidden: true
    },{
      path: 'expert_biz_related',
      name: 'expert_biz_related',
      component: () => import('@/views/experts/expert_biz_related'),
      meta: { title: '商圈列表', icon: 'el-icon-user-solid' },
      hidden: true
    },{
      path: 'shop_member',
      name: 'shop_member',
      component: () => import('@/views/experts/shop_member'),
      meta: { title: '店长门店列表', icon: 'el-icon-user-solid' },
      hidden: true
    },{
      path: 'experts_grade_eleven',
      name: 'experts_grade_eleven',
      component: () => import('@/views/experts/experts_grade_eleven'),
      meta: { title: '店长列表', icon: 'el-icon-user-solid' },
    },{
      path: 'experts_grade_two',
      name: 'experts_grade_two',
      component: () => import('@/views/experts/experts_grade_two'),
      meta: { title: '区域经销商列表', icon: 'el-icon-user-solid' },
    },{
      path: 'experts_category_add',
      name: 'experts_category_add',
      component: () => import('@/views/experts/experts_category_add/index'),
      meta: { title: '分销员类型添加', icon: 'el-icon-user-solid' },
      hidden: true
    },{
      path: 'experts_category_edit',
      name: 'experts_category_edit',
      component: () => import('@/views/experts/experts_category_edit/index'),
      meta: { title: '专家类型编辑', icon: 'el-icon-user-solid' },
      hidden: true
    },
    {
      path: 'order_share_log',
      name: 'order_share_log',
      component: () => import('@/views/experts/order_share_log'),
      meta: { title: '佣金日志管理', icon: 'el-icon-user-solid' }
    },
    {
      path: 'user_distribution_log',
      name: 'user_distribution_log',
      component: () => import('@/views/experts/user_distribution_log'),
      meta: { title: '用户佣金管理', icon: 'el-icon-user-solid' }
    }
    ]
  },
  {
    path: '/order',
    component: Layout,
    redirect: "/order/order",
    name: 'order_title',
    meta: { title: '订单管理', icon: 'el-icon-notebook-2' },
    children: [{
      path: 'order',
      name: 'order',
      component: () => import('@/views/order/order/index'),
      meta: { title: '订单列表', icon: 'el-icon-document' }
    },{
      path: 'order_no_check',
      name: 'order_no_check',
      component: () => import('@/views/order/order_no_check/index'),
      meta: { title: '未核销订单列表', icon: 'el-icon-document' }
    },{
      path: 'print',
      name: 'print',
      component: () => import('@/views/order/print/index'),
      meta: { title: '订单打印', icon: 'el-icon-document' },
      hidden: true
    },{
      path: 'order_detail',
      name: 'order_detail',
      component: () => import('@/views/order/order_detail/index'),
      meta: { title: '订单详情', icon: 'el-icon-document' },
      hidden: true
    },
    // {
    //   path: 'order_add',
    //   name: 'order_add',
    //   component: () => import('@/views/order/order_add/index'),
    //   meta: { title: '添加订单', icon: 'el-icon-edit-outline' },
    // },
    {
      path: 'order_edit',
      name: 'order_edit',
      component: () => import('@/views/order/order_edit/index'),
      meta: { title: '编辑订单', icon: 'el-icon-edit-outline' },
      hidden: true
    },{
      path: 'refund',
      name: 'refund',
      component: () => import('@/views/order/refund/index'),
      meta: { title: '退款管理', icon: 'el-icon-bangzhu' }
    },
    // {
    //   path: 'count',
    //   name: 'order_count',
    //   component: () => import('@/views/order/count/index'),
    //   meta: { title: '订单统计', icon: 'el-icon-discount' }
    // },
  ]
  },
  {
    path: '/marketing',
    component: Layout,
    redirect: "/marketing/promotion",
    name: 'marketing_title',
    meta: { title: '营销', icon: 'el-icon-money' },
    children: [
    //   {
    //   path: 'promotion',
    //   name: 'promotion',
    //   component: () => import('@/views/marketing/promotion/index'),
    //   meta: { title: '促销活动', icon: 'el-icon-postcard' }
    // },
    {
      path: 'group_buying',
      name: 'group_buying',
      component: () => import('@/views/marketing/group_buying/index'),
      meta: { title: '拼团', icon: 'el-icon-crop' }
    },{
      path: 'group_buying_edit',
      name: 'group_buying_edit',
      component: () => import('@/views/marketing/group_buying/group_buying_edit/index'),
      meta: { title: '拼团编辑', icon: '' },
      hidden: true
    },{
      path: 'group_buying_add',
      name: 'group_buying_add',
      component: () => import('@/views/marketing/group_buying/group_buying_add/index'),
      meta: { title: '拼团添加', icon: '' },
      hidden: true
    },{
      path: 'moment',
      name: 'moment',
      component: () => import('@/views/marketing/moment/index'),
      meta: { title: '秒杀', icon: 'el-icon-warning-outline' }
    },{
      path: 'moment_edit',
      name: 'moment_edit',
      component: () => import('@/views/marketing/moment/moment_edit/index'),
      meta: { title: '秒杀编辑', icon: '' },
      hidden: true
    },{
      path: 'moment_add',
      name: 'moment_add',
      component: () => import('@/views/marketing/moment/moment_add/index'),
      meta: { title: '秒杀添加', icon: '' },
      hidden: true
    },
    {
      path: 'discount',
      name: 'discount',
      component: () => import('@/views/marketing/discount/index'),
      meta: { title: '优惠券类型', icon: 'el-icon-s-data' }
    },
    {
      path: 'discount_prop',
      name: 'discount_prop',
      component: () => import('@/views/marketing/discount/discount_prop/index'),
      meta: { title: '优惠券列表', icon: 'el-icon-s-data' },
      hidden: true
    },{
      path: 'discount_edit',
      name: 'discount_edit',
      component: () => import('@/views/marketing/discount/discount_edit/index'),
      meta: { title: '优惠券编辑', icon: '' },
      hidden: true
    },{
      path: 'discount_add',
      name: 'discount_add',
      component: () => import('@/views/marketing/discount/discount_add/index'),
      meta: { title: '优惠券添加', icon: '' },
      hidden: true
    },
  ]
  },

  {
    path: '/system',
    component: Layout,
    redirect: "/system/article_page",
    name: 'system_title',
    hidden: true,
    meta: { title: '系统', icon: 'el-icon-s-tools' },
    children: [
      {
        path: 'role',
        name: 'role',
        component: () => import('@/views/system/role/index'),
        meta: { title: '角色管理', icon: 'el-icon-user-solid' }
      },{
      path: 'role_edit',
      name: 'role_edit',
      component: () => import('@/views/system/role/role_edit/index'),
      meta: { title: '角色编辑', icon: '' },
      hidden: true
    },{
      path: 'role_add',
      name: 'role_add',
      component: () => import('@/views/system/role/role_add/index'),
      meta: { title: '角色添加', icon: '' },
      hidden: true
    },
    {
      path: 'manager',
      name: 'manager',
      component: () => import('@/views/system/manager/index'),
      meta: { title: '管理员', icon: 'el-icon-user' }
    },{
      path: 'manager_edit',
      name: 'manager_edit',
      component: () => import('@/views/system/manager/manager_edit/index'),
      meta: { title: '管理员编辑', icon: '' },
      hidden: true
    },{
      path: 'manager_add',
      name: 'manager_add',
      component: () => import('@/views/system/manager/manager_add/index'),
      meta: { title: '管理员添加', icon: '' },
      hidden: true
    },
    {
      path: 'basic',
      name: 'basic',
      component: () => import('@/views/system/basic/index'),
      meta: { title: '基本设置', icon: 'el-icon-setting' }
    },
    // {
    //   path: 'message',
    //   name: 'message',
    //   component: () => import('@/views/system/message/index'),
    //   meta: { title: '消息管理', icon: 'el-icon-s-comment' }
    // },
    // {
    //   path: 'log',
    //   name: 'log',
    //   component: () => import('@/views/system/log/index'),
    //   meta: { title: '日志管理', icon: 'el-icon-s-grid' }
    // }
    ]
  },
  {
    path: '/user',
    component: Layout,
    redirect: "/user/user",
    name: 'user_title',
    meta: { title: '用户', icon: 'el-icon-user' },
    children: [
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/user/user'),
        meta: { title: '用户管理', icon: 'el-icon-user-solid' }
      },
      {
        path: 'user_detail',
        name: 'user_detail',
        component: () => import('@/views/user/user/user_detail'),
        meta: { title: '用户详情', icon: 'el-icon-user-solid' }
      },
      {
        path: 'user_edit',
        name: 'user_edit',
        component: () => import('@/views/user/user/user_edit'),
        meta: { title: '用户编辑', icon: '' },
        hidden: true,
      },{
        path: 'user_finance',
        name: 'user_finance',
        component: () => import('@/views/user/user_finance/index'),
        meta: { title: '财务信息', icon: '' },
        hidden: true
      },{
        path: 'account_log',
        name: 'account_log',
        component: () => import('@/views/user/account_log/index'),
        meta: { title: '收入明细', icon: '' },
        hidden: true
      },{
        path: 'point',
        name: 'point',
        component: () => import('@/views/user/point/index'),
        meta: { title: '积分', icon: '' },
        hidden: true
      },{
        path: 'withdraw',
        name: 'withdraw',
        component: () => import('@/views/user/withdraw/index'),
        meta: { title: '提现列表', icon: '' },
        hidden: true
      },{
        path: 'online_recharge',
        name: 'online_recharge',
        component: () => import('@/views/user/online_recharge/index'),
        meta: { title: '充值列表', icon: '' },
        hidden: true
      },
      {
        path: 'vip',
        name: 'vip',
        component: () => import('@/views/user/vip'),
        meta: { title: '会员管理', icon: 'el-icon-user-solid' }
      },

    ]
  },

  // {
  //   path: '/case',
  //   component: Layout,
  //   children: [{
  //     path: 'case',
  //     name: 'case',
  //     component: () => import('@/views/case/index'),
  //     meta: { title: '项目', icon: '' }
  //   }]
  // },
  // {
  //   path: '/task',
  //   component: Layout,
  //   children: [{
  //     path: 'task',
  //     name: 'task',
  //     component: () => import('@/views/task/index'),
  //     meta: { title: '任务', icon: '' }
  //   }]
  // },

  // {
  //   path: '/delivery',
  //   component: Layout,
  //   redirect: "/delivery/delivery",
  //   name: 'delivery_title',
  //   meta: { title: '自提点', icon: 'el-icon-user-solid' },
  //   children: [{
  //     path: 'delivery',
  //     name: 'delivery',
  //     component: () => import('@/views/delivery/delivery/index'),
  //     meta: { title: '自提点列表', icon: 'el-icon-user-solid' }
  //   },{
  //     path: 'delivery_add',
  //     name: 'delivery_add',
  //     component: () => import('@/views/delivery/delivery_add/index'),
  //     meta: { title: '添加自提点', icon: 'el-icon-user-solid' },
  //   },{
  //     path: 'delivery_edit',
  //     name: 'delivery_edit',
  //     component: () => import('@/views/delivery/delivery_edit/index'),
  //     meta: { title: '编辑自提点', icon: 'el-icon-user-solid' },
  //     hidden: true
  //   },{
  //     path: 'station',
  //     name: 'station',
  //     component: () => import('@/views/station/index'),
  //     meta: { title: '站点统计', icon: 'el-icon-user-solid' },
  //   },{
  //     path: 'distribution',
  //     name: 'distribution',
  //     component: () => import('@/views/distribution/index'),
  //     meta: { title: '分销统计', icon: 'el-icon-user-solid' },
  //   },]
  // },


  // {
  //   path: '/article_page',
  //   component: Layout,
  //   redirect: "/article_page/article_page",
  //   name: 'article_page_title',
  //   meta: { title: '文章', icon: 'el-icon-notebook-2' },
  //   children: [
  //   {
  //     path: 'article_page',
  //     name: 'article_page',
  //     component: () => import('@/views/system/article_page/index.vue'),
  //     meta: { title: '文章', icon: 'el-icon-notebook-2' }
  //   },
  //   {
  //     path: 'article_page_add',
  //     name: 'article_page_add',
  //     component: () => import('@/views/system/article_page_add/index.vue'),
  //     meta: { title: '添加文章', icon: 'el-icon-notebook-2' },
  //     hidden: true
  //   },
  //   {
  //     path: 'article_page_edit',
  //     name: 'article_page_edit',
  //     component: () => import('@/views/system/article_page_edit/index.vue'),
  //     meta: { title: '编辑文章', icon: 'el-icon-notebook-2' },
  //     hidden: true
  //   },
  //   {
  //     path: 'article_page_category',
  //     name: 'article_page_category',
  //     component: () => import('@/views/system/article_page_category/index'),
  //     meta: { title: '文章类型', icon: 'el-icon-notebook-2' },
  //   },
  //   {
  //     path: 'article_page_category_add',
  //     name: 'article_page_category_add',
  //     component: () => import('@/views/system/article_page_category_add/index'),
  //     meta: { title: '添加文章类型', icon: 'el-icon-notebook-2' },
  //     hidden: true
  //   },
  //   {
  //     path: 'article_page_category_edit',
  //     name: 'article_page_category_edit',
  //     component: () => import('@/views/system/article_page_category_edit/index'),
  //     meta: { title: '编辑文章类型', icon: 'el-icon-notebook-2' },
  //     hidden: true
  //   }]
  // },
  {
    path: '/data',
    component: Layout,
    redirect: "/data/station",
    name: "data_title",
    meta: { title: '数据统计', icon: 'el-icon-notebook-2' },
    children: [{
      path: 'station',
      name: 'station',
      component: () => import('@/views/station/index'),
      meta: { title: '站点统计', icon: 'el-icon-user-solid' },
    },{
      path: 'distribution',
      name: 'distribution',
      component: () => import('@/views/distribution/index'),
      meta: { title: '分销统计', icon: 'el-icon-user-solid' },
    },]
  },
  // {
  //   path: '/QA',
  //   component: Layout,
  //   redirect: "/QA/question",
  //   name: "QA_title",
  //   meta: { title: '问答管理', icon: 'el-icon-notebook-2' },
  //   children: [{
  //     path: "question",
  //     name: 'question',
  //     component: () => import('@/views/QA/question/index'),
  //     meta: { title: '问题列表', icon: 'el-icon-notebook-2' },
  //   },
  //   {
  //     path: 'question_add',
  //     name: 'question_add',
  //     component: () => import('@/views/QA/question_add/index.vue'),
  //     meta: { title: '添加问题', icon: 'el-icon-notebook-2' },
  //     hidden: true
  //   },
  //   {
  //     path: 'question_edit',
  //     name: 'question_edit',
  //     component: () => import('@/views/QA/question_edit/index.vue'),
  //     meta: { title: '编辑问题', icon: 'el-icon-notebook-2' },
  //     hidden: true
  //   },{
  //     path: "answer",
  //     name: 'answer',
  //     component: () => import('@/views/QA/answer/index'),
  //     meta: { title: '回答列表', icon: 'el-icon-notebook-2' },
  //   },
  //   {
  //     path: 'answer_add',
  //     name: 'answer_add',
  //     component: () => import('@/views/QA/answer_add/index.vue'),
  //     meta: { title: '添加回答', icon: 'el-icon-notebook-2' },
  //     hidden: true
  //   },
  //   {
  //     path: 'answer_edit',
  //     name: 'answer_edit',
  //     component: () => import('@/views/QA/answer_edit/index.vue'),
  //     meta: { title: '编辑回答', icon: 'el-icon-notebook-2' },
  //     hidden: true
  //   },]
  // },

  {
    path: '/system_setting',
    component: Layout,
    redirect: "/system_setting/distribution_setting",
    name: 'distribution_setting',
    meta: { title: '系统设置', icon: 'el-icon-notebook-2' },
    children: [{
      path: 'distribution_setting',
      name: 'distribution_setting',
      component: () => import('@/views/system/distribution_setting/index.vue'),
      meta: { title: '分销设置', icon: 'el-icon-notebook-2' }
    },{
      path: 'log',
      name: 'log',
      component: () => import('@/views/system/log/index.vue'),
      meta: { title: '系统日志', icon: 'el-icon-notebook-2' }
    },
    {
      path: 'article_page',
      name: 'article_page',
      component: () => import('@/views/system/article_page/index.vue'),
      meta: { title: '文章', icon: 'el-icon-notebook-2' }
    },
    {
      path: 'article_page_add',
      name: 'article_page_add',
      component: () => import('@/views/system/article_page_add/index.vue'),
      meta: { title: '添加文章', icon: 'el-icon-notebook-2' },
      hidden: true
    },
    {
      path: 'article_page_edit',
      name: 'article_page_edit',
      component: () => import('@/views/system/article_page_edit/index.vue'),
      meta: { title: '编辑文章', icon: 'el-icon-notebook-2' },
      hidden: true
    },
    {
      path: 'article_page_category',
      name: 'article_page_category',
      component: () => import('@/views/system/article_page_category/index'),
      meta: { title: '文章类型', icon: 'el-icon-notebook-2' },
    },
    {
      path: 'article_page_category_add',
      name: 'article_page_category_add',
      component: () => import('@/views/system/article_page_category_add/index'),
      meta: { title: '添加文章类型', icon: 'el-icon-notebook-2' },
      hidden: true
    },
    {
      path: 'article_page_category_edit',
      name: 'article_page_category_edit',
      component: () => import('@/views/system/article_page_category_edit/index'),
      meta: { title: '编辑文章类型', icon: 'el-icon-notebook-2' },
      hidden: true
    },


    ]
  },

      {
        path: '/404',
        component: () => import('@/views/404'),
        hidden: true
      },
      { path: '*', redirect: '/404', hidden: true }
    ]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
